

<%@ page import="com.surelution.projects.crm.Market" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
		<resource:dateChooser />
        <g:set var="entityName" value="${message(code: 'market.label', default: 'Market')}" />
        <title><g:message code="default.edit.label" args="[entityName]" /></title>
        <script type="text/javascript" src="${resource(dir:'js/datechooser',file:'datechooser.js')}"></script>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
        </div>
        <div class="body">
            <h1><g:message code="default.edit.label" args="[entityName]" />(修改时请将所有字段都填上,如有不知道的,请填0)</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${marketInstance}">
            <div class="errors">
                <g:renderErrors bean="${marketInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:uploadForm method="post" >
                <g:hiddenField name="id" value="${marketInstance?.id}" />
                <g:hiddenField name="version" value="${marketInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                                                    
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="name"><g:message code="market.name.label" default="Name" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: marketInstance, field: 'name', 'errors')}">
                                    <g:textField name="name" value="${marketInstance?.name}" />
                                </td>
                            </tr>
                        
                        	<tr class="prop">
                                <td valign="top" class="name">
                                  <label for="area"><g:message code="market.area.label" default="area" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: marketInstance, field: 'area', 'errors')}">
                                    <g:select name="area.id" from="${com.surelution.projects.crm.StationArea.list()}" optionKey="id" optionValue="areaName" value="${marketInstance?.area?.id}"  />
                                </td>
                            </tr>
                                     
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="type"><g:message code="market.type.label" default="Type" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: marketInstance, field: 'type', 'errors')}">
                                    <g:select name="type.id" from="${com.surelution.projects.crm.MarketType.list()}" optionKey="id" optionValue="title" value="${marketInstance?.type?.id}"  />
                                </td>
                            </tr>
                        
                        	<tr class="prop">
                                <td valign="top" class="name">
                                  <label for="cardType"><g:message code="market.cardType.label" default="cardType" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: marketInstance, field: 'cardType', 'errors')}">
                                    <g:select name="marketType.id" from="${com.surelution.projects.crm.MarketSpecies.list()}" optionKey="id" optionValue="type" value="${marketInstance?.marketType?.id}"  />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="address"><g:message code="market.address.label" default="Address" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: marketInstance, field: 'address', 'errors')}">
                                    <g:textField name="address" value="${marketInstance?.address}" />
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="manager"><g:message code="market.manager.label" default="manager" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: marketInstance, field: 'manager', 'errors')}">
                                    <g:textField name="manager" value="${fieldValue(bean: marketInstance, field: 'manager')}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="managerTel"><g:message code="market.managerTel.label" default="managerTel" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: marketInstance, field: 'managerTel', 'errors')}">
                                    <g:textField name="managerTel" value="${fieldValue(bean: marketInstance, field: 'managerTel')}" />
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="carePoint"><g:message code="market.carePoint.label" default="carePoint" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: marketInstance, field: 'provideSite', 'errors')}">
                                    <g:textField name="carePoint" value="${fieldValue(bean: marketInstance, field: 'carePoint')}" />
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="provideSite"><g:message code="market.provideSite.label" default="provideSite" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: marketInstance, field: 'provideSite', 'errors')}">
                                    <g:textField name="provideSite" value="${fieldValue(bean: marketInstance, field: 'provideSite')}" />
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="betweenDistance"><g:message code="market.betweenDistance.label" default="betweenDistance" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: marketInstance, field: 'betweenDistance', 'errors')}">
                                    <g:textField name="betweenDistance" value="${fieldValue(bean: marketInstance, field: 'betweenDistance')}" />
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="requirement"><g:message code="market.requirement.label" default="requirement" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: marketInstance, field: 'requirement', 'errors')}">
                                    <g:textField name="requirement" value="${fieldValue(bean: marketInstance, field: 'requirement')}" />
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="gasPredictSale"><g:message code="market.gasPredictSale.label" default="gasPredictSale" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: marketInstance, field: 'gasPredictSale', 'errors')}">
                                    <g:textField name="gasPredictSale" value="${fieldValue(bean: marketInstance, field: 'gasPredictSale')}" />
                                </td>
                            </tr>
                            
                             <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="fuelPredictSale"><g:message code="market.fuelPredictSale.label" default="fuelPredictSale" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: marketInstance, field: 'fuelPredictSale', 'errors')}">
                                    <g:textField name="fuelPredictSale" value="${fieldValue(bean: marketInstance, field: 'fuelPredictSale')}" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="firstSaleTime"><g:message code="market.firstSaleTime.label" default="firstSaleTime" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: marketInstance, field: 'firstSaleTime', 'errors')}">
                                    <richui:dateChooser name="firstSaleTime" locale="zh" format="yyyy-MM-dd" value="${marketInstance.firstSaleTime}"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="discountNum"><g:message code="market.discountNum.label" default="discountNum" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: marketInstance, field: 'discountNum', 'errors')}">
                                    <g:textField name="discountNum" value="${fieldValue(bean: marketInstance, field: 'discountNum')}" />
                                </td>
                            </tr>

                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span>
	       	         <sec:ifAnyGranted roles="ROLE_ADMIN">
	                    <span class="button"><g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" /></span>
	         		</sec:ifAnyGranted>
                </div>
            </g:uploadForm>
        </div>
    </body>
</html>
